feat(inflekt): add shared name-matching utilities and case helpers#71
Merged
pyramation merged 2 commits intomainfrom Mar 26, 2026
Merged
feat(inflekt): add shared name-matching utilities and case helpers#71pyramation merged 2 commits intomainfrom
pyramation merged 2 commits intomainfrom
Conversation
- Add matching.ts with fuzzyFindByName, namesMatch, normalizeName, normalizeNameSingular - Add toCamelCase, toPascalCase, toScreamingSnake to case.ts - Export new matching module from index - Add comprehensive tests for all new functions - Bump version to 0.4.0
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds shared utilities to
inflektto consolidate duplicated name-matching and case-conversion logic scattered across the constructive monorepo (specificallygraphql/queryandgraphql/codegen). This is a companion PR for constructive#889 which introduced ad-hoc fuzzy matching in two separate files.New
matching.tsmodule:normalizeName— lowercase + strip underscores for delimiter-insensitive comparisonnormalizeNameSingular— same as above plus naive trailing's'removalfuzzyFindByName<T>— generic exact-then-fuzzy lookup (replaces duplicated logic infield-selector.tsandselect.ts)namesMatch— boolean check for whether two names refer to the same entityNew case helpers in
case.ts:toCamelCase— likecamelizebut also handles hyphenstoPascalCase— likecamelize(PascalCase default) but also handles hyphenstoScreamingSnake—camelCase/PascalCase→SCREAMING_SNAKE_CASEThese were previously copy-pasted in
graphql/codegen/src/core/codegen/utils.ts.Version bumped to 0.4.0.
Review & Testing Checklist for Human
matching.tsimportssingularizefrom./pluralizebut never uses it. Confirm whethernormalizeNameSingularshould use propersingularize()instead of naiveslice(0, -1), or remove the import. Naive stripping will fail for irregular plurals (e.g.,"addresses"→"addresse"won't match"Address").toCamelCasevscamelizeoverlap: Both exist now with slightly different behavior (hyphen handling). Verify this won't confuse consumers or cause inconsistent usage across the constructive monorepo.pnpm testinpackages/inflektto confirm all 80 tests pass after merge.Notes
constructivewill wire these up and remove the duplicated code.'s'strip rather than fullsingularize()). This keeps the behavior identical during extraction, but may warrant a follow-up to use proper singularization.Link to Devin session: https://app.devin.ai/sessions/e3dd5ed7753043bd8d2166793364cd42
Requested by: @pyramation